package com.jlpay.openapi.demo.openmerch.device;

import com.jlpay.open.jlpay.sdk.java.model.openmerch.device.request.UnionPayCodeAddRequest;
import com.jlpay.open.jlpay.sdk.java.model.openmerch.device.response.UnionPayCodeAddResponse;
import com.jlpay.open.jlpay.sdk.java.utils.json.JsonUtils;
import com.jlpay.openapi.demo.JlpayOpenApiService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author liaochangyi
 * @since 2025/06/30
 **/
public class UnionpayAddService {

    private static final Logger LOGGER = LoggerFactory.getLogger(UnionpayAddService.class);

    public static void main(String[] args) {
        UnionPayCodeAddRequest unionPayCodeAddRequest = buildUnionPayCodeAddRequest();
        UnionPayCodeAddResponse unionPayCodeAddResponse = JlpayOpenApiService.openMerchWithCryptoService()
                .post(unionPayCodeAddRequest, UnionPayCodeAddResponse.class);
        LOGGER.info("银联原生码加机响应:{}", JsonUtils.toString(unionPayCodeAddResponse));
    }

    private static UnionPayCodeAddRequest buildUnionPayCodeAddRequest(){
        UnionPayCodeAddRequest unionPayCodeAddRequest = new UnionPayCodeAddRequest();

        unionPayCodeAddRequest.setMerchNo("84940535193A006");
        unionPayCodeAddRequest.setPrintMerchName("测试打印商户名称");

        return unionPayCodeAddRequest;
    }

}
